const express = require("express");
const { findBannerService,updateBannerService } = require("../service/bannerService");
const { ValidationError } = require("../utils/errors");
const { formatResponse } = require("../utils/tool");
const router = express.Router();

router.get("/",async function(req,res,next){
   const data = await findBannerService()
   res.send(formatResponse(200,"",data))
})


router.post("/",async function(req,res,next){
   console.log(req.query,'req.query');
   console.log(req.body,'req.body');
   console.log(req.params,'req.params');
   const data = await updateBannerService(req.query)
   res.send(formatResponse(200,"",data))
})

module.exports = router;